package cn.tedu.dubbo.webapi.controller;

import cn.tedu.dubbo.service.CartService;
import cn.tedu.micro.service.common.JsonResult;
import cn.tedu.micro.service.pojo.param.CartAddParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/cart")
@RefreshScope
public class CartController {
    @Autowired
    private CartService cartService;


    @PostMapping("/add")
    public JsonResult addCart(CartAddParam cartAddParam){
        Boolean result = cartService.addCart(cartAddParam);
        if(result==false)
            return JsonResult.fail("新增失败");
        return JsonResult.ok("添加成功");
    }

    @GetMapping("/select")
    public JsonResult selectCart(){
       return JsonResult.ok();
    }

}
